home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 757 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.9 KB

  1. Path: solon.com!not-for-mail
  2. From: spc@gate.net (Sean 'Captain Napalm' Conner)
  3. Newsgroups: comp.std.c,comp.lang.c.moderated
  4. Subject: Re: printf() format extensions - looking for beta testers...
  5. Date: 17 Apr 1996 10:47:35 -0500
  6. Organization: CyberGate, Inc.
  7. Sender: clc@solutions.solon.com
  8. Approved: clc@solutions.solon.com
  9. Message-ID: <4l33qn$7rv@solutions.solon.com>
  10. References: <4koecq$8up@solutions.solon.com> <4kr74a$k8o@solutions.solon.com> <4ksk72$rm6@solutions.solon.com>
  11. NNTP-Posting-Host: solutions.solon.com
  12.  
  13. In article <4ksk72$rm6@solutions.solon.com> seebs@solon.com writes:
  14.  >In article <4kr74a$k8o@solutions.solon.com>,
  15.  >Sean 'Captain Napalm' Conner <spc@gate.net> wrote:
  16.  >>>%# would be a poor choice; the conversion func for %# is one which returns
  17.  >>>a magic cookie to set the alternate format flag.  :)
  18.  >
  19.  >>  Oh.  Ah.  Well.  What IS available?
  20.  >
  21.  >Whatever you want; it's just that if you change %#, you change the behavior
  22.  >of existing legal programs.
  23.  >
  24.   Existing legal programs using your printf()?  
  25.  
  26.   I checked, and %#X is a legal (ANSI C) specification, wouldn't you know
  27. 8-)
  28.  
  29.  >>  Well, why not change the approach? 
  30.  
  31.  [ much snipped ]
  32.  
  33.  >>  Less chance of clashes, and more flexible I feel.
  34.  >
  35.  >Well, that would break existing code, 
  36.  
  37.   Again, existing code you wrote?  Gee, just like make requiring tabs (and
  38. only tabs).  Can't fix it, because too many make files would "break" (sorry,
  39. my anti-Unix bias is showing 8-)
  40.  
  41.  >of course; you can actually
  42.  >do something similar;
  43.  >    int funcconv(va_list *ap, char *into, int len, fmtspec *fs) {
  44.  >        fmtconv fc;
  45.  >
  46.  >        fc = va_arg(*ap, fmtconv);
  47.  >        return fc(ap, into, len, fs);
  48.  >    }
  49.  >
  50.  >And just bind this to whatever character you want.  (In my sample
  51.  >implementation, it's %<.)
  52.  >
  53.   But you still have the problem of overloading (what if I wanted to use %<
  54. for something?).
  55.  
  56.   -spc (Hmmm ... I think we're straying here ... )
  57.